package com.thh.shirodemo.service;

import com.thh.shirodemo.bean.User;
import com.thh.shirodemo.mapper.UserMapper;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;

/**
 * @author shkstart
 * @create 2022-07-19-10:59
 */
@Service
public class UserService {
    @Resource
    UserMapper userMapper;

    //根据用户名查找数据库中的用户
    public User queryUserByName(String username){
        User user = new User();
        user=userMapper.getUser(username);
        if(user==null) return null;
        return user;
    }

    //根据用户id查找数据库中的用户
    public User queryUserById(Integer userId){
        User user = new User();
        user = userMapper.getUserById(userId);
        if(user==null) return null;
        return user;
    }
}
